package prob;

import java.io.IOException;
import com.sun.grizzly.http.SelectorThread;
import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory;
import com.sun.jersey.api.core.PackagesResourceConfig;
import com.sun.jersey.api.core.ResourceConfig;

public class TestServer {
	public static void main(String[] args) {
		{
			String url = "http://localhost:9998";

			// The SelectorThread class is the entry point when embedding the
			// Grizzly Web Server.
			SelectorThread threadSelector;
			try {

				// Configuration of web application
				ResourceConfig rc = new PackagesResourceConfig("prob");

				// Add AuthFilter
				rc.getProperties().put(
						"com.sun.jersey.spi.container.ContainerRequestFilters",
						"prob.MyFilter");

				// Create server container
				threadSelector = GrizzlyServerFactory.create(url, rc);
				System.in.read();
				threadSelector.stopEndpoint();
				System.exit(0);
			} catch (IllegalArgumentException | IOException e1) {
				e1.printStackTrace();
			}
		}
	}
}